package main

import (
	"fmt"
	"strings"
)



func main()  {
	var mima string
	fmt.Println("请输入密码:")
	fmt.Scan(&mima)
	output := passwd(mima)
	fmt.Print(output)
}

func passwd(m string)(score int){
	//判断密码长度
	score = 2
	if len(m) <8{
		fmt.Println("密码小于八位")
	}else{
		score += 1
	}
	//判断密码复杂度
	lst := [4]int{0,0,0,0}
	for i:=0;i<len(m);i++ {
		if m[i] >= 48 && m[i] <= 57 {
			lst[0] = 1
		} else if m[i] >= 97 && m[i] <= 122 {
			lst[1] = 1
		} else if m[i] >= 65 && m[i] <= 90 {
			lst[2] = 1
		} else {
			lst[3] = 1
		}
	}
	sum := 0
	for i:=0;i<len(lst);i++{
		sum += lst[i]
	}
	if sum>=3{
		score += 1
	}

	//判断子串
	for i:=0;i<len(m)-2;i++{
		if strings.Count(m,m[i:i+3])<2{
			score += 1
		}
		break
	}
	return score
}

